#pragma once
#include "..\AutoPtr\AutoPtr.h"
#include "GrammarTree.h"
#include "CharClass.h"
#include "AdjacentTable.h"
#include <wtypes.h>

class NFA
{
public:
	AdjancentTable<NAutoPtr<CharClass>> NFATable;
	AdjancentTable<NAutoPtr<CharClass>> NFATable2;

	NFA() : Mark(1){}

	void BuildEpsilonNfa(NAutoPtr<GrammarTreeNode> Current,CharClassList CharList);
	void PrintNFA();
protected:
	int Mark;
	int Start;
	int End;

	void BuildEpsilonNfa(NAutoPtr<GrammarTreeNode> Current,CharClassList CharList,BOOL bNot);
	void BuildChar(NAutoPtr<GrammarTreeNode> Current,CharClassList CharList,BOOL bNot = FALSE);
	void BuildOperator(NAutoPtr<GrammarTreeNode> Current,CharClassList CharList,BOOL bNot = FALSE);
	void BuildTransferred(NAutoPtr<GrammarTreeNode> Current,CharClassList CharList);
};